tiny optimization Title::isValidRedirectTarget()
authorPavel Astakhov <pastakhov@yandex.ru>
Tue, 21 Jul 2015 10:47:05 +0000 (16:47 +0600)
committerPavel Astakhov <pastakhov@yandex.ru>
Tue, 21 Jul 2015 10:47:05 +0000 (16:47 +0600)
Not special page cannot be invalid redirect target

Change-Id: Ie8cc0c9717963472bdaf5b9d143938bd05bef6ba

includes/Title.php

index 477373a..4530f43 100644 (file)
@@ -4823,15 +4823,17 @@ class Title {
        public function isValidRedirectTarget() {
                global $wgInvalidRedirectTargets;
 
-               // invalid redirect targets are stored in a global array, but explicitly disallow Userlogout here
-               if ( $this->isSpecial( 'Userlogout' ) ) {
-                       return false;
-               }
-
-               foreach ( $wgInvalidRedirectTargets as $target ) {
-                       if ( $this->isSpecial( $target ) ) {
+               if ( $this->isSpecialPage() ) {
+                       // invalid redirect targets are stored in a global array, but explicitly disallow Userlogout here
+                       if ( $this->isSpecial( 'Userlogout' ) ) {
                                return false;
                        }
+
+                       foreach ( $wgInvalidRedirectTargets as $target ) {
+                               if ( $this->isSpecial( $target ) ) {
+                                       return false;
+                               }
+                       }
                }
 
                return true;